This page last changed on Jul 28, 2010 by kgomes.

Apache Tomcat is great for JSP and Serlvet applications, but normally it defaults to the 8080 port. That is fine but users often have firewalls setup to block non-standard port (anything other than port 80). So the apache http server has a module called mod_jk that will allow the Apache http server to serve as a front end for Tomcat. This allows you to map incoming HTTP calls to specific servlet calls to the Tomcat engine. Very handy for working around the firewall issue. Here is how I set it up on the server new-ssds.mbari.org. This was a case where I had to map the following:

http://new-ssds.mbari.org:8080/mars

to something that would work through the standard http port that was already running on the same machine. Ideally, I would like this to map to:

http://new-ssds.mbari.org/mars

Using mod_jk with Apache and JBoss/Tomcat Bundle

Configure Apache

The current system, as installed, is running Apache 2.0.54 on red hat enterprise server. The tomcat I am running is actually embedded in JBoss 4.0.3SP1 and is version 5.5. When I did a 'locate mod_jk' on the new-ssds.mbari.org machine, it looks like it has mod_jk 1.2.6 which should be OK.

I edited the /etc/httpd/conf/httpd.conf file and added this at the very bottom of the file:

# Include mod_jk configuration file
Include conf/mod-jk.conf

I then created a new file in /etc/httpd/conf called mod-jk.conf with the following body:

# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile /etc/httpd/conf/workers.properties

# Where to put jk shared memory
JkShmFile /etc/httpd/logs/mod_jk.shm

# Where to put jk logs
JkLogFile /etc/httpd/logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel debug

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# Define uri mappings
JkMount /mars   ssds
JkMount /mars/* ssds
JkMount /ssds   ssds
JkMount /ssds/* ssds
JkMount /cimt   ssds
JkMount /cimt/* ssds
JkMount /servlet ssds
JkMount /servlet/* ssds

I then created the file /etc/httpd/conf/workers.properties with the contents:

# Define list of workers that will be used
# for mapping requests
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
#
worker.list=ssds

# Define mars worker
worker.ssds.port=8009
worker.ssds.host=134.89.2.25
worker.ssds.type=ajp13
Note host IP

Normally the host can be set to 'localhost', but because I had to run JBoss with it bound to 134.89.2.25, this disables access from 'localhost'. Setting it to the exact IP address fixes this problem

I then restarted the apache server.

Configure JBoss/Tomcat bundle

I edited the file /opt/jboss/server/default/deploy/jbossweb-tomcat55.sar/server.xml. I made sure the section that turns on the AJP connector was not commented out (it was not) and it looks like:

      <!-- A AJP 1.3 Connector on port 8009 -->
      <Connector port="8009" address="${jboss.bind.address}"
         emptySessionPath="true" enableLookups="false" redirectPort="8443"
         protocol="AJP/1.3"/>

Lastly, I edited the /opt/jboss/server/default/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml and changed the following line:

      <attribute name="UseJK">false</attribute>

to:

      <attribute name="UseJK">true</attribute>

Then I restarted JBoss.

Document generated by Confluence on Feb 03, 2026 16:22